package com.fjnldx.mes.controller.energy;

import com.fjnldx.mes.domain.domainReq.TimeSlot;
import com.fjnldx.mes.domain.domainReq.TimeSlotFour;
import com.fjnldx.mes.domain.domainReq.TimeSlotThree;
import com.fjnldx.mes.domain.domainReq.TimeSlotTwo;
import com.fjnldx.mes.domain.domainRes.Result;
import com.fjnldx.mes.service.energy.EnergyNewService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/energyNew")
@Api(value = "新能源管理", tags = "新能源管理")
public class EnergyNewController {

    @Resource
    EnergyNewService energyNewService;

    @PostMapping("/querySummaryOfPowerConsumptionOfProcess")
    @ApiOperation(value = "查询各工序电耗汇总", notes = "查询各工序电耗汇总")
    public Result querySummaryOfPowerConsumptionOfProcess(@RequestBody TimeSlot params) {
        return energyNewService.querySummaryOfPowerConsumptionOfProcess(params);
    }

    @PostMapping("/querySummaryOfRingXs")
    @ApiOperation(value = "查询电耗汇总-细纱-络筒圆环", notes = "查询电耗汇总-细纱-络筒圆环")
    public Result querySummaryOfRingXs(@RequestBody TimeSlot params) {
        return energyNewService.querySummaryOfRingXsAndLt(params);
    }

    @PostMapping("/queryProcessPowerConsumption")
    @ApiOperation(value = "工序电耗柱状图和表格", notes = "工序电耗柱状图和表格")
    public Result queryProcessPowerConsumption(@RequestBody TimeSlotTwo params) {
        return energyNewService.queryProcessPowerConsumption(params);
    }

    @PostMapping("/queryProcessPowerConsumptionLineChart")
    @ApiOperation(value = "工序电耗折线图", notes = "工序电耗折线图")
    public Result queryProcessPowerConsumptionLineChart(@RequestBody TimeSlotTwo params) {
        return energyNewService.queryProcessPowerConsumptionLineChart(params);
    }

    @PostMapping("/queryProcessPowerConsumptionPz")
    @ApiOperation(value = "品种电耗柱状图和表格", notes = "品种电耗柱状图和表格")
    public Result queryProcessPowerConsumptionPz(@RequestBody TimeSlotThree params) {
        return energyNewService.queryProcessPowerConsumptionPz(params);
    }

    @PostMapping("/queryProcessPowerConsumptionLineChartPz")
    @ApiOperation(value = "品种电耗折线图", notes = "品种电耗折线图")
    public Result queryProcessPowerConsumptionLineChartPz(@RequestBody TimeSlotThree params) {
        return energyNewService.queryProcessPowerConsumptionLineChartPz(params);
    }

    @PostMapping("/queryProcessPowerConsumptionDetail")
    @ApiOperation(value = "机台电耗明细柱状图和表格", notes = "机台电耗明细柱状图和表格")
    public Result queryProcessPowerConsumptionDetail(@RequestBody TimeSlotFour params) {
        return energyNewService.queryProcessPowerConsumptionDetail(params);
    }

    @PostMapping("/queryProcessPowerConsumptionDetailLineChart")
    @ApiOperation(value = "机台电耗明细折线图", notes = "机台电耗明细折线图")
    public Result queryProcessPowerConsumptionDetailLineChart(@RequestBody TimeSlotFour params) throws InterruptedException {
        return energyNewService.queryProcessPowerConsumptionDetailLineChart(params);
    }

}
